package com.qf.mprefer.ex;

import com.qf.mprefer.utils.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理器
 */
@RestControllerAdvice
public class GlobalExHandler {

    @ExceptionHandler(QFException.class)
    public R handQfEx(QFException ex){
        ex.printStackTrace();
        return R.error(ex.getMsg());
    }

    @ExceptionHandler(Exception.class)
    public R handEx(Exception ex){
        ex.printStackTrace();
        return R.error(ex.getMessage());
    }

}
